<template>
  <div>
    <div v-if="device === 'desktop'" class="dswd-products-first">
      <div class="first-wrap">
        <div class="products-first-text">
          <div class="products-en-title">Products</div>
          <div class="products-title">产品体系</div>
          <div class="products-sub-title">
            AI智绘地暖<br>为暖通设计师量身打造
          </div>
          <div class="oper-button">
            <span class="custom-button" @click="immExperience">立即体验</span>
          </div>
        </div>
        <div class="products-first-img">
          <img src="../../assets/image/products/first/products9.png" alt="">
        </div>
        <div class="products-first-video">
          <video
            src="../../assets/image/products/first/Sea - 10816.mp4"
            controls="controls"
          />
        </div>
      </div>
      <div class="dividing-line" />
    </div>
    <div v-if="device === 'ipad'" class="dswd-p-products-first">
      <div class="first-wrap">
        <div class="products-first-text">
          <div class="products-en-title">Products</div>
          <div class="products-title">产品体系</div>
          <div class="products-sub-title">
            TransBIM智能设计平台<br>智绘暖通，智绘工程
          </div>
          <div class="oper-button">
            <span class="custom-button" @click="immExperience">立即体验</span>
          </div>
        </div>
        <div class="products-first-img">
          <img src="../../assets/image/products/first/products9.png" alt="">
        </div>
        <div class="products-first-video">
          <video
            src="../../assets/image/products/first/Sea - 10816.mp4"
            controls="controls"
          />
        </div>
      </div>
      <div class="m-bottom-divide" />
    </div>
    <div v-if="device === 'mobile'" class="dswd-m-products-first">
      <div class="first-wrap">
        <div class="products-first-text">
          <div class="products-en-title">Products</div>
          <div class="products-title">产品体系</div>
          <div class="products-sub-title">
            TransBIM智能设计平台<br>智绘暖通，智绘工程
          </div>
          <div class="oper-button">
            <span class="custom-button" @click="immExperience">立即体验</span>
          </div>
        </div>
        <div class="products-first-img">
          <img src="../../assets/image/products/first/products9.png" alt="">
        </div>
        <div class="products-first-video">
          <video
            src="../../assets/image/products/first/Sea - 10816.mp4"
            controls="controls"
          />
        </div>
      </div>
      <div class="m-bottom-divide" />
    </div>
    <pay-com
      v-if="showPayCom"
      :visible.sync="showPayCom"
      @closeDialog="closeDialog"
    />
  </div>
</template>

<script>
import { mapState } from 'vuex'
import PayCom from '@/components/PayCom'
export default {
  components: { PayCom },
  data() {
    return {
      userInfo: {},
      filters: {
        item: '1',
        union: ''
      },
      size: '',
      showPayCom: false
    }
  },
  computed: {
    ...mapState({
      device: (state) => state.app.device
    })
  },
  beforeMount() {
    if (
      sessionStorage.getItem('userInfo') !== undefined &&
      sessionStorage.getItem('userInfo') !== null
    ) {
      this.userInfo = Object.assign(
        {},
        JSON.parse(sessionStorage.getItem('userInfo'))
      )
    }
  },
  methods: {
    immExperience() {
      if (this.userInfo.mobile === undefined) {
        this.$router.push('/login')
      } else {
        this.showPayPage()
      }
    },
    // 显示付款界面
    showPayPage() {
      this.showPayCom = true
    },
    closeDialog() {
      this.showPayCom = false
    }
  }
}
</script>

<style lang="scss" scoped>
@import "~@/styles/products/first.scss";
</style>